%% -*- erlang -*-
{cover_enabled, true}.
{cover_export_enabled, true}.
{cover_excl_mods, [
    gateway_gatt_char_assert_loc_pb,
    gateway_gatt_char_wifi_services_pb,
    gateway_gatt_char_wifi_connect_pb,
    gateway_gatt_char_wifi_remove_pb,
    gateway_gatt_char_add_gateway_pb
]}.

{erl_opts, [
    {parse_transform, lager_transform},
    debug_info,
    warnings_as_errors,
    {i, "./_build/default/plugins/gpb/include"}
]}.

{gpb_opts, [
    {i, "src"},
    {o_erl, "src/pb"},
    {o_hrl, "src/pb"},
    {msg_name_prefix, "gateway_"},
    {msg_name_suffix, "_pb"},
    {module_name_suffix, "_pb"},
    {strings_as_binaries, false},
    type_specs
]}.

{plugins, [rebar3_gpb_plugin]}.

{provider_hooks, [
    {pre, [
        {compile, {protobuf, compile}},
        {clean, {protobuf, clean}}
    ]}
]}.

{deps, [
    {erlang_ale, ".*", {git, "https://github.com/helium/erlang_ale", {branch, "master"}}},
    {h3, ".*", {git, "https://github.com/helium/erlang-h3.git", {branch, "master"}}},
    {gatt, ".*", {git, "https://github.com/helium/ebus-gatt", {branch, "master"}}},
    {connman, ".*", {git, "https://github.com/helium/ebus-connman", {branch, "master"}}},
    {clique, ".*", {git, "https://github.com/helium/clique.git", {branch, "develop"}}},
    {lager, "3.9.2"}
]}.

{xref_checks, [
    undefined_function_calls,
    undefined_functions,
    deprecated_function_calls,
    deprecated_functions
]}.

{relx, [
    {release, {gateway_config, "0.1.0"}, [lager, gateway_config, runtime_tools]},
    {generate_start_script, true},
    {extended_start_script, true},
    {extended_start_script_extensions, [
        {ble, "extensions/ble"},
        {wifi, "extensions/wifi"},
        {advertise, "extensions/advertise"},
        {lights, "extensions/lights"}
    ]},
    {overlay, [
        {copy, "scripts/extensions/ble", "bin/extensions/ble"},
        {copy, "scripts/extensions/wifi", "bin/extensions/wifi"},
        {copy, "scripts/extensions/advertise", "bin/extensions/advertise"},
        {copy, "scripts/extensions/lights", "bin/extensions/lights"},
        {template, "config/vm.args", "{{output_dir}}/releases/{{release_version}}/vm.args"},
        {copy, "config/com.helium.Config.conf", "config/com.helium.Config.conf"}
    ]},
    {dev_mode, true},
    {sys_config, "config/sys.config"}
]}.

{profiles, [
    {prod, [
        {relx, [
            {sys_config, "config/sys.config"},
            {dev_mode, false},
            {include_src, false},
            {system_libs, false},
            {include_erts, false}
        ]}
    ]},
    {dev, [
        {relx, [
            {overlay, [{copy, "config/sys.config", "config/sys.config"}]},
            {sys_config, "config/test.config"},
            {dev_mode, true},
            {include_erts, true}
        ]}
    ]},
    {test, [
        {deps, [proper, {meck, "0.8.12"}]},
        {erl_opts, [nowarn_export_all]}
    ]}
]}.

{ct_opts, [{sys_config, "config/test.config"}]}.

{shell, [
    {apps, [lager, gateway_config, ebus]}
]}.
